iteration_behavior Derived Type

type, public :: iteration_behavior

Defines a set of parameters that describe the behavior of the iteration process.


Components

Type Visibility Attributes Name Initial
logical, public :: converge_on_chng

True if the solution converged as a result of no appreciable change in solution points between iterations; else, false.

logical, public :: converge_on_fcn

True if the solution converged as a result of a zero-valued function; else, false.

logical, public :: converge_on_zero_diff

True if the solution appears to have settled on a stationary point such that the gradient of the function is zero-valued; else, false.

integer, public :: fcn_count

Specifies the number of function evaluations performed.

integer, public :: gradient_count

Specifies the number of gradient vector evaluations performed.

integer, public :: iter_count

Specifies the number of iterations performed.

integer, public :: jacobian_count

Specifies the number of Jacobian evaluations performed.


Constructor

public interface iteration_behavior

  • private function ib_constructor(max_iters) result(rst)

    Initializes the iteration_behavior object. All fields are set such that all counters are zero and all convergence flags are false.

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in) :: max_iters

    The maximum number of iterations the solver is allowed to take. An NL_INVALID_INPUT_ERROR is thrown if this value is less than one.

    Return Value type(iteration_behavior)

    The iteration_behavior object.


Type-Bound Procedures

procedure, public :: get_convergence_history => ib_get_history

procedure, public :: initialize => ib_init

  • private subroutine ib_init(this, max_iters)

    Initializes the iteration_behavior object. All fields are reset such that all counters are zero and all convergence flags are false.

    Arguments

    Type IntentOptional Attributes Name
    class(iteration_behavior), intent(inout) :: this

    The iteration_behavior object.

    integer, intent(in) :: max_iters

    The maximum number of iterations the solver is allowed to take. An NL_INVALID_INPUT_ERROR is thrown if this value is less than one.

procedure, public :: log_iteration => ib_log_iteration

  • private subroutine ib_log_iteration(this, resid, dx, grad)

    Registers an iteration given the appropriate metrics.

    Arguments

    Type IntentOptional Attributes Name
    class(iteration_behavior), intent(inout) :: this

    The iteration_behavior object.

    real(kind=real64), intent(in) :: resid

    The residual value.

    real(kind=real64), intent(in) :: dx

    The norm of the solution direction vector.

    real(kind=real64), intent(in) :: grad

    The norm of the gradient vector.